import request from '@/utils/request'

/**
 * ['prizeConfig', 'Questions', 'topIssues', 'skinAnalysis',
'Cosmetics', 'Strategy','Product','IndexCompareText','IndexCompareText']
 */
// const baseUrlApiStart = 'skin/'
const apiPath = {
  current: {
    changeConfigration: 'skin/configration',
    baseUrl: 'skin/configration/current',
    prizeConfig: 'skin/configration/current/prizeConfig',
    strategy: 'skin/configration/current/Strategy',
    product: 'skin/configration/current/Product',
  },
  statistics: {
    detections: 'skin/statistics/detections', // 测肤历史

    proposals: 'skin/statistics/proposals', //报告历史
    strategys: 'skin/statistics/strategys', // 推荐历史
    users: 'skin/statistics/users', // 用户
  },
  exportUrl: {
    detections: 'skin/statistics/export/detections', // 测肤历史
    proposals: 'skin/statistics/export/proposals', //报告历史
    strategys: 'skin/statistics/export/strategys', // 推荐历史
    users: 'skin/statistics/export/users', // 用户
  },
}

export function getPrizeList(data) {
  return request({
    url: 'skin/configration/current/prizeConfig',
    method: 'get',
    // data,
  })
}
export function getStrategyList() {
  return request({
    url: 'skin/configration/current/Strategy',
    method: 'get',
  })
}
export function getList(path) {
  return request({
    url: `${apiPath.current.baseUrl}/${path}`,
    method: 'get',
  })
}
export function getStatisticsList(data) {
  return request({
    url: `${apiPath.statistics.detections}`,
    method: 'get',
    params: data,
  })
}
export function getStatisticsUsersList(data) {
  return request({
    url: `${apiPath.statistics.users}`,
    method: 'get',
    params: data,
  })
}
export function getStatisticsStrategysList(data) {
  return request({
    url: `${apiPath.statistics.strategys}`,
    method: 'get',
    params: data,
  })
}
export function getStatisticsProposalsList(data) {
  return request({
    url: `${apiPath.statistics.proposals}`,
    method: 'get',
    params: data,
  })
}

export function exportStatisticsUrlList(name, data) {
  console.log(name, data, 'url:', apiPath.exportUrl)
  return request({
    url: `${apiPath.exportUrl[name]}`,
    method: 'get',
    params: data,
    // responseType: 'blob',
  })
}
export function exportUrl(url) {
  return request({
    url,
    method: 'get',
  })
}
export function doEdit(data) {
  return request({
    url: apiPath.current.changeConfigration,
    method: 'post',
    data,
  })
}

export function doDelete(data) {
  return request({
    url: '/table/doDelete',
    method: 'post',
    data,
  })
}
